﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using System.Linq;
using Cafe.BusinessLogic;
using DevExpress.XtraEditors;
using Cafe.Presentation;
namespace Cafe
{
    public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        private CafeManagementService _cafeService = null;
        public MainForm()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            
        }

        private void bbCafe_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new SalesManagementForm());
        }
        private void OpenChild(Form form)
        {
            foreach (Form child in this.MdiChildren)
            {
                if (child.Name == form.Name)
                {
                    child.Activate();
                    return;
                }
            }
            form.MdiParent = this;
            form.Show();
        }

        private void bbCategories_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new CategoriesForm());
        }

        private void bbBillHistory_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new BillHistoryForm());
        }

        private void bbStatistics_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new StatisticsForm());
        }

        private void bbUsers_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new UsersForm());
        }

        private void bbSystem_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new SystemForm());
        }

        private void bbAccount_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenChild(new AccountForm());
        }
    }
}